package regexppractice;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @description:
 * @author: jhy
 * @time: 2021/6/1 14:57
 */

//[]的作用
public class RegExpDemo6 {

    public static void main(String[] args) {
        String content = "jhy..";
        //String regStr = ".";//表示匹配除了\n的所有字符
        String regStr = "[.]";//表示匹配.

        Pattern pattern = Pattern.compile(regStr);
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()){
            System.out.println("匹配到："+matcher.group(0));
        }
    }
}
